import './index.scss';
import { useNavigate } from 'react-router-dom';
import { DownOutlined } from '@ant-design/icons';
import { Dropdown, Menu } from 'antd';
import Notice from '@/assets/icons/notice-icon.png';
import Logo from '@/assets/photos/network/turingbot.png';
import Sculpture from '@/assets/photos/user-sculpture.png';
import Chrome from '@/Chrome';
const pageHead = () => {
    const out = () => {
        localStorage.removeItem('token')
        if(Chrome) {
            window.location.href = '/#/login'
        } else {
            window.location.href = '/#/'
        }
        
    }
    //头像下拉框显示内容
    const menutext = (
        <Menu>
            <Menu.Item key={'1'}>
                <a rel="noopener noreferrer">
                    {localStorage.getItem('email')}
                </a>
            </Menu.Item>
            
            <Menu.Item key={'2'}>
                <a rel="noopener noreferrer" onClick={() => {out()}}>
                    退出登录
                </a>
            </Menu.Item>
            {/* <Menu.Item key={'3'}>
                <a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">
                    xxxxxx
                </a>
            </Menu.Item> */}
        </Menu>
    );
    

    return (
        // onClick={() => {window.location.href = '/#/'}}
        <div className="pageHeadMain">
            <img src={Logo} alt="" className="pageHeadLogo"  />

            <div className="pageHeadRight">
                <img src={Notice} className="menu-item notice-image " alt="" />

                <Dropdown overlay={menutext} placement="top">
                    <div>
                        <img src={Sculpture} className="menu-item sculpture-image " alt="" />
                        <DownOutlined />
                    </div>
                </Dropdown>
            </div>
        </div>
    );
};

export default pageHead;
